﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OnlineBookstore
{
    public class cl_0423_UsersAccount : cl_0423_MyObserver
    {
        private string userName;//注册者姓名
        private cl_0423_AbstractLevel userLevel;//用户等级
        public int paidMoney = 0;//理论支付价钱

        public cl_0423_UsersAccount(string userName)
        {
            this.userName = userName;
            this.userLevel = new cl_0423_OrdinaryLevel(this);
            Console.WriteLine(this.userName + "注册成功");
   
        }
        public void BuyBook(int paidMoney)
        {
            userLevel.BuyBook(paidMoney);
        }
        public string getName()
        {
            return this.userName;
        }

        public cl_0423_AbstractLevel getLevel()
        {
            return this.userLevel;
        }

        public void setLevel(cl_0423_AbstractLevel userLevel)
        {
            this.userLevel = userLevel;
        }

        public override void response()
        {
            Console.WriteLine("会员"+this.userName+"很高兴收到活动消息通知");
        }

        public void CalcRealAmount()
        {
            userLevel.CalcRealAmount();
        }

        public void ChangeCredit()
        {
            userLevel.ChangeCredit();
        }
    }
}